window.rootPath = (function (src) {
    if(document.scripts.length==0)
    {
        return "";
    }
    for (let i = 0; i < document.scripts.length; i++) {
        var src = document.scripts[i].src;
        if(src.indexOf("/ui/")>-1)
        {
            return src.substring(0, src.lastIndexOf("/ui/") + 4);
        }
    }
    return "ui/";
})();
layui.config({
    base: rootPath + "layuimini/js/lay-module/",
    version: true
}).extend({
    miniAdmin: "layuimini/miniAdmin", // layuimini后台扩展
    miniMenu: "layuimini/miniMenu", // layuimini菜单扩展
    miniTab: "layuimini/miniTab", // layuimini tab扩展
    miniTheme: "layuimini/miniTheme", // layuimini 主题扩展
    miniTongji: "layuimini/miniTongji", // layuimini 统计扩展
    step: 'step-lay/step', // 分步表单扩展
    treetable: 'treetable-lay/treetable', //table树形扩展
    tableSelect: 'tableSelect/tableSelect', // table选择扩展
    iconPickerFa: 'iconPicker/iconPickerFa', // fa图标选择扩展
    echarts: 'echarts/echarts', // echarts图表扩展
    echartsTheme: 'echarts/echartsTheme', // echarts图表主题扩展
    layarea: 'layarea/layarea', //  省市县区三级联动下拉选择器
    treeSelect: 'treeSelect/treeSelect',
	auth: 'auth/auth', // 网络请求
	xmSelect: 'xmSelect/xm-select' // 网络请求
});
function getQueryString(name) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}
function removeEmpty(obj) {
    Object.keys(obj).forEach(function(key) {
        (obj[key] && typeof obj[key] === 'object') && removeEmpty(obj[key]) ||
        (obj[key] === '' || obj[key] === null) && delete obj[key]
    });
    return obj;
};
